package cn.iocoder.yudao.module.infrastructure.mail.api;

import cn.iocoder.yudao.module.api.infrastructure.mail.MailSendApi;
import cn.iocoder.yudao.module.api.infrastructure.mail.dto.MailSendSingleToUserReqDTO;
import cn.iocoder.yudao.module.infrastructure.mail.service.MailSendService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

/**
 * 邮件发送 API 实现类
 *
 * @author wangjingyi
 */
@Service
@Validated
public class MailSendApiImpl implements MailSendApi {

    @Resource
    private MailSendService mailSendService;

    @Override
    public Long sendSingleMailToAdmin(MailSendSingleToUserReqDTO dto) {
        return mailSendService.sendSingleMailToAdmin(dto.getMail(), dto.getUserId(),
                dto.getTemplateCode(), dto.getTemplateParams());
    }

    @Override
    public Long sendSingleMailToMember(MailSendSingleToUserReqDTO dto) {
        return mailSendService.sendSingleMailToMember(dto.getMail(), dto.getUserId(),
                dto.getTemplateCode(), dto.getTemplateParams());
    }

}
